package cm.cool.web.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import cm.cool.web.bean.OrderDto;
import cm.cool.web.data.OrderMapper;
import cm.cool.web.util.respon.R;
import cm.cool.web.util.respon.ResultEncoding;

@Service
public class OrderService {
	
	@Autowired
	private OrderMapper orderMapper;

	public List<OrderDto> selectByPrimaryKey (Long id) {
		return null;
	}

	public R getTotalPrice(OrderDto order) {
		R r = new R();

		try {
			int count = orderMapper.getTotalPrice(order.getTotalPrice());
			r.setData(count);
		} catch (Exception e) {
			e.printStackTrace();
			r.setCode(ResultEncoding.R_ERR);
			r.setMsg("查询异常");
			return r;
		}
		return r;
	}

	public R getTotalNum(OrderDto order) {
		R r = new R();

		try {
			int count = orderMapper.getTotalNum(order.getTotalNum());
			r.setData(count);
		} catch (Exception e) {
			e.printStackTrace();
			r.setCode(ResultEncoding.R_ERR);
			r.setMsg("查询异常");
			return r;
		}
		return r;
	}
	
	
}
